home *** CD-ROM | disk | FTP | other *** search
- ;**** instant message ****
- ;completely relocatable
- ;by Jeff Jones
- ;(c) 1991 Softdisk Publishing
- ; sys line,mess col,message$,box col,["active keys"]
- ;addr+7 for screen stash
- ;addr+374 for screen restore
-
- .dis
- .org $c000
- .mem
- ;obj "@0:i-message.o"
-
- lda #0
- sta 249
- sec
- bcs line'links
-
- screen'stash'entry lda #255
- sta 249
- bne screen'stash
-
- line'links ldy #24
- - lda 217,y
- ora #128
- sta 217,y
- dey
- bpl -
-
- ;**** SCREEN STASH ****
-
- screen'stash sei
- ldx #0
- lda 1
- sta 250
- stx 1
- lda #$d8 ;high byte of dest screen
- stx 253
- sta 254; dest screen
- lda 648
- sta 252; source screen
- ldy #0
- sty 251
-
- ;begin copying
-
- - lda (251),y
- sta (253),y
- iny
- bne -
- inx
- inc 254
- inc 252
-
- cpx #4
- bne -
- ldx #0
-
- lda #>55296
- sta 252
-
- - dec 1 ; roms all in
- lda (251),y
- inc 1 ; roms all out
- sta (253),y
- iny
- bne -
- inc 252
- inc 254
- inx
- cpx #4
- bne -
-
- lda 250
- sta 1
- cli
-
- bit 249
- bvc begin
- rts
-
- begin jsr $aefd ;get line number
- jsr $ad8a
- jsr $b7f7
- lda $14
- sta 254
- and #31
- bne +
- lda #1 ; too low
- sta 254
- + cmp #24
- bcc +
- lda #23 ;too high
- + sta 253
-
- tax
- ldy #0
- clc
- jsr $fff0 ;move to message line
- ldy #37
- lda #32 ; load a space
- - sta (209),y ;clear portion of line
- dey
- cpy #1
- bne -
-
- jsr $aefd ; get message color
- jsr $ad8a
- jsr $b7f7
- lda $14
- sta 646
-
- jsr $aefd ;get message
- jsr $ad9e
- jsr $b6a3
-
- beq abort ;Say! Where's da message?
-
- pha ;stash message length
- ldx $22 ;_{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}
- stx 251 ; message location
- ldx $23 ;_{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}
- stx 252
- lsr ;divide length by 2
- sta 253
- lda #20
- sec
- sbc 253 ;center
- tay
- bit 254 ;check center bit (64)
- bvc + ;Well then DON'T center
- ldy #0
- + lda 254
- and #31
- tax
- clc
- jsr $fff0 ;move to message line
- pla ;remember message length
- sta 253
- ldy #0
- - lda (251),y
- jsr $ffd2 ;print the message
- iny
- cpy 253
- bne -
- beq +
-
- abort rts
-
- + jsr $aefd ;get box color
- jsr $ad8a
- jsr $b7f7
- lda $14
- sta 646
- lda 254 ;get line number
- and #31 ;chop off center bit
- tax
- dex ;move up one line
- ldy #1
- clc
- jsr $fff0 ; move to upper left
- lda #176
- jsr $ffd2 ;print upper left
- ldy #36
- lda #"{SHIFT-*}"
- - jsr $ffd2 ; print top line
- dey
- bne -
- lda #174 ;print upper right
- jsr $ffd2
- inc 214 ; increment line
- lda #1
- sta 211
- jsr 58732 ;plot
- lda #"{SHIFT--}"
- jsr $ffd2 ;print vertical bar
- lda #38
- sta 211
- jsr 58732
- lda #"{SHIFT--}"
- jsr $ffd2
-
- inc 214 ;down and over
- lda #1
- sta 211
- jsr 58732
- lda #173
- jsr $ffd2 ;print bottom left
- ldy #36
- lda #"{SHIFT-*}"
- - jsr $ffd2 ;print bottom line
- dey
- bne -
- lda #189
- jsr $ffd2 ;print bottom right
-
- jsr $aefd ;get active keys
- jsr $ad9e
- jsr $b6a3
- beq abort
- sta 253
- ldx $22
- stx 251
- ldx $23
- stx 252
-
- getkey jsr $ffe4
- beq getkey
-
- ldy #0
- - cmp (251),y ;cmp active keys
- bne +
- beq key'buffer ;match found
- + iny
- cpy 253
- bne -
- beq getkey ;nothing
-
- key'buffer sta 631
- lda #1
- sta 198
-
- screen'restore lda 53265
- bpl screen'restore
-
- sei
- ldx #0
- lda 1
- sta 250
- stx 1
- lda #$d8; high byte of source screen
- stx 253
- sta 254; source screen
- lda 648
- sta 252; dest screen
- ldy #0
- sty 251
-
- ;begin copying
-
- - lda (253),y
- sta (251),y
- iny
- bne -
- inx
- inc 254
- inc 252
-
- cpx #4
- bne -
- ldx #0
-
- lda #>55296
- sta 252
-
- - lda (253),y
- dec 1
- sta (251),y
- inc 1
- iny
- bne -
- inc 252
- inc 254
- inx
- cpx #4
- bne -
-
- lda 250
- sta 1
- cli
-
- rts
-